/***************************************************************************
 *   Copyright (C) 2009 by Bernhard Neuhofer   *
 *   mail@bneu.at   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include "message.h"

#ifndef MESSAGECONTAINER_H
#define MESSAGECONTAINER_H

/**
* @brief Servers a a root for all message containers.
* The implementation of the methods follows in conrete subclasses, 
* e.g. <code>VectorBuffer</code>, as they all
* depend on internals of the actually used container (e.g. list or vector).
*/
class MessageContainer
{
public:

/**
 * Returns the first message in the container.
 * @return 
 */
virtual Message* first()=0;

/**
 * Returns the last message in the container.
 * @return 
 */
virtual Message* last()=0;

/**
 * Returns the message right after the passed one
 * @param message The message acting as starting point
 * @return 
 */
virtual Message* next(Message* message)=0;

/**
 * Checks if the container is empty
 * @return 
 */
virtual bool isEmpty()=0;

/**
 * Returns the number of messages in the container
 * @return 
 */
virtual unsigned int size()=0;

/**
 * Checks if the container contains the given mesage
 * @param message The message in question
 * @return 
 */
virtual bool contains(Message* message)=0;

/**
 * Insert a message into the container
 * @param message The message to be inserted
 */
virtual void insert(Message* message)=0;

/**
 * Removes a message from the container.
 * @param message The message which should be removed.
 */
virtual void remove(Message* message)=0;

};

#endif //MESSAGECONTAINER_H